/**
 * 
 */
package com.thor.palmmall.rest.product.converter;

import org.springframework.core.convert.converter.Converter;

import com.thor.palmmall.rest.product.AProductChangeLine;
import com.thor.palmmall.spi.product.SProductChangeLine;

/**
 * @author NuoSa
 *
 * @since 1.0
 */
public class AProductChangeLineConverter
    implements Converter<SProductChangeLine, AProductChangeLine> {

  public static AProductChangeLineConverter getInstance() {
    if (instance == null)
      instance = new AProductChangeLineConverter();
    return instance;
  }

  private static AProductChangeLineConverter instance;

  private AProductChangeLineConverter() {
  }

  @Override
  public AProductChangeLine convert(SProductChangeLine source) {
    if (source == null) {
      return null;
    }
    AProductChangeLine target = new AProductChangeLine();
    target.setCode(source.getCode());
    target.setName(source.getName());
    target.setNewPrice(source.getNewPrice());
    target.setOldPrice(source.getOldPrice());
    target.setProperties(source.getProperties());
    target.setUuid(source.getUuid());
    target.setVersion(source.getVersion());
    return target;
  }

}
